<!--
@Descripttion 国际化语言切换
@version 1.0.0
@Author Bell
@ 使用
  引入组件
    import ChangeLanguage from '@/components/i18n/change-language'
  注册组件
    components: {
      ChangeLanguage
    }
  使用
    <ChangeLanguage />
 -->
<template>
  <el-dropdown @command="handle" class="cursor-p">
    <span class="el-dropdown-link">
      {{$t('button.Language')}}<i class="el-icon-arrow-down el-icon--right"></i>
    </span>
    <el-dropdown-menu slot="dropdown">
      <el-dropdown-item command="zh-CN">中文</el-dropdown-item>
      <el-dropdown-item command="en">English</el-dropdown-item>
    </el-dropdown-menu>
  </el-dropdown>
</template>

<script>
export default {
  name: 'change-language',
  props: {},
  data() {
    return {}
  },
  mounted() {
  },
  methods: {
    handle(value) {
      this.$i18n.locale = value
      localStorage.setItem('LANGUAGE_KEY', value)
      this.$router.go(0)
    }
  }
}
</script>
